extends layout.jade

block header
- var menu = 'admin'

block content
  .admin
    if(articles.length === 0)
      p
        | 没有任何文章，
        a(href="post") 点此
        | 添加。
    else
      table.table.table-stripped
        thead
          tr
            th(colspan="2") 动作
            th 文章标题
        tbody
          each article,index in articles
            tr(data-id="#{article._id}", class=(!article.published)?'unpublished':'')
              td.action
                button.btn.btn-danger.btn-sm.remove(type="button")
                  span.glyphicon.glyphicon-remove(title="删除")
              td.action
                button.btn.btn-default.btn-sm.publish(type="button")
                  span.glyphicon(class=(article.published)?"glyphicon-pause":"glyphicon-play",title=(article.published)?"未发布":"已发布")
              td= article.title
